
const getPostAuditKey = function(menuId){
    return "audit_k1d93afwAdjkPCdfaopdhGgjdfl38349sdjfdf_" + menuId
}
const getServiceAuditKey = function(serviceName){
    return "audit_ksd93kfwAdjkPCdfJopohGgjdfl38349sdjfdf_" + serviceName
}
const buyShopId = 10;
const sellShopId = 11;
const buyEquipId = 13;
const sellEquipId = 12;
const buyRecruitId = 14;
const sellRecruitId = 15;
const buyDangId = 17;
const sellDangId = 16;
const sellShopMenu = {
    id: sellShopId, // 11
    parentId: 2,
    name: '转店',
    icon: '',
    level: 2,
    url: '',
    sort: 1,
    subList: []
}
const buyShopMenu = {
    id: buyShopId, // 10
    parentId: 2,
    name: '找店',
    icon: '',
    level: 2,
    url: '',
    sort: 0,
    subList: []
}
const buyEquipMenu = {
    id: buyEquipId, //13
    parentId: 3,
    name: '购买二手设备',
    icon: '',
    level: 2,
    url: '',
    sort: 1,
    subList: []
};
const sellEquipMenu = {
    id: sellEquipId, //12
    parentId: 3,
    name: '处理二手设备',
    icon: '',
    level: 2,
    url: '',
    sort: 0,
    subList: []
};
const buyRecruitMenu = {
    id: buyRecruitId, // 14
    parentId: 4,
    name: '招聘',
    icon: '',
    level: 2,
    url: '',
    sort: 0,
    subList: []
};
const sellRecruitMenu = {
    id: sellRecruitId, // 15
    parentId: 4,
    name: '求职',
    icon: '',
    level: 2,
    url: '',
    sort: 1,
    subList: []
};

const buyDangMenu = {
    id: buyDangId, //17
    parentId: 5,
    name: '求租',
    icon: '',
    level: 2,
    url: '',
    sort: 1,
    subList: []
};
const sellDangMenu = {
    id: sellDangId, // 16
    parentId: 5,
    name: '招租',
    icon: '',
    level: 2,
    url: '',
    sort: 0,
    subList: []
};

const menuList = [
    {
        id: 2,
        name: '安心找店',
        icon: '/static/images/shop.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=2',
        sort: 0,
        subList: [
            sellShopMenu,
            buyShopMenu,
        ]
    },
    {
        id: 3,
        name: '省心转店',
        icon: '../../static/images/equip.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=3',
        sort: 1,
        subList: [
            sellEquipMenu,
            buyEquipMenu,
        ]
    },
    {
        id: 4,
        name: '营商求助',
        icon: '../../static/images/recruit.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=4',
        sort: 2,
        subList: [
            buyRecruitMenu,
            sellRecruitMenu,
        ]
    },
    {
        id: 5,
        name: '设备转让',
        icon: '../../static/images/dangkou.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=5',
        sort: 3,
        subList: [
            sellDangMenu,
            buyDangMenu,
        ]
    },
	{
	    id: 6,
	    name: '更多服务',
	    icon: '../../static/images/gengduo.svg',
	    level: 1,
	    url: '/pages/post_add/post_add?parentMenuId=6',
	    sort: 3,
	    subList: [
	        sellDangMenu,
	        buyDangMenu,
	    ]
	},
];

const industryList =[
    { id: 11000, name: '餐饮' },
    { id: 12000, name: '美甲' },
    { id: 13000, name: '美容美发' },
    { id: 14000, name: '图文' },
    { id: 15000, name: '健身' },
    { id: 16000, name: '超市' },
    { id: 17000, name: '服装' },
];

const labelList = [
    "餐饮店主", "网店经营者", "美容师", "美发师", "快递员", "厨神", "手机维修技师", "服务员", "五金店主", "个体户店主",
  ]
  
const getMenu = function(menuId){
    for (let i = 0; i < menuList.length; i++) {
        if (menuId == menuList[i].id) {
            return menuList[i];
        } else {
            for (let j = 0; j < menuList[i].subList.length; j++) {
                if (menuId == menuList[i].subList[j].id) {
                    return menuList[i].subList[j];
                }
            }
        }
    }
    return null;
}
const getIndustry = function(industryId){
    return industryList.filter(indu => indu.id === industryId)[0]
}
const getSubMenuList = function(parentMenuId){
    for (let i = 0; i < menuList.length; i++) {
        if (parentMenuId == menuList[i].id) {
            return menuList[i].subList;
        }
    }
    return [];
}
const isShop = function(menuId){
    return buyShopId === menuId || sellShopId === menuId;
}
const isDang = function(menuId){
    return buyDangId == menuId || sellDangId == menuId;
}
const isEquip = function(menuId){
    return buyEquipId == menuId || sellEquipId == menuId;
}
const isRecruit = function(menuId){
    return buyRecruitId == menuId || sellRecruitId == menuId;
}

const isShopOrDang = function(menuId){
    return isShop(menuId) || isDang(menuId);
}

const dictPublishTypeList =[
    { id: 0, name: '本地' },
    // {id: 1, name: '全国'},
];
const leafMenuList = function(){
    return [
        {
            id: sellShopId, // 11
            name: '转店',
            icon: '',
            level: 2,
            url: '',
            sort: 1,
            subList: [],
            param:{
                pageNum: 1,
                pageSize: 10,
                menuId: sellShopId
            },
            list:[]
        },
        {
            id: buyShopId, // 10
            name: '找店',
            icon: '',
            level: 2,
            url: '',
            sort: 0,
            subList: [],
            param:{
                pageNum: 1,
                pageSize: 10,
                menuId: buyShopId
            },
            list:[]
        },
        {
            id: sellEquipId, //12
            name: '处理二手设备',
            icon: '',
            level: 2,
            url: '',
            sort: 0,
            subList: [],
            param:{
                pageNum: 1,
                pageSize: 10,
                menuId: sellEquipId
            },
            list:[]
        },
        {
            id: buyEquipId, //13
            name: '购买二手设备',
            icon: '',
            level: 2,
            url: '',
            sort: 1,
            subList: [],
            param:{
                pageNum: 1,
                pageSize: 10,
                menuId: buyEquipId
            },
            list:[]
        },
        {
            id: sellDangId, // 16
            name: '招租',
            icon: '',
            level: 2,
            url: '',
            sort: 0,
            subList: [],
            param:{
                pageNum: 1,
                pageSize: 10,
                menuId: sellDangId
            },
            list:[]
        },
        {
            id: buyDangId, //17
            name: '求租',
            icon: '',
            level: 2,
            url: '',
            sort: 1,
            subList: [],
            param:{
                pageNum: 1,
                pageSize: 10,
                menuId: buyDangId
            },
            list:[]
        },
    ]
}

const conditionIndustryList = [
    {
        id: '',
        name: '全部'
    },
    ...industryList
]

const conditionMenuList = [
    {
        id: '',
        name: '全部',
        subList: [
            {
                id: '',
                name: '全部'
            }
        ]
    },
    {
        id: 2,
        name: '找店/转店',
        icon: '/static/images/shop.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=2',
        sort: 0,
        subList: [
            {
                id: '',
                name: '全部'
            },
            sellShopMenu,
            buyShopMenu,
        ]
    },
    {
        id: 3,
        name: '二手设备',
        icon: '../../static/images/equip.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=3',
        sort: 1,
        subList: [
            {
                id: '',
                name: '全部'
            },
            sellEquipMenu,
            buyEquipMenu,
        ]
    },
    {
        id: 4,
        name: '招聘求职',
        icon: '../../static/images/recruit.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=4',
        sort: 2,
        subList: [
            {
                id: '',
                name: '全部'
            },
            buyRecruitMenu,
            sellRecruitMenu,
        ]
    },
    {
        id: 5,
        name: '档口服务',
        icon: '../../static/images/dangkou.svg',
        level: 1,
        url: '/pages/post_add/post_add?parentMenuId=5',
        sort: 3,
        subList: [
            {
                id: '',
                name: '全部'
            },
            sellDangMenu,
            buyDangMenu,
        ]
    },
];

export default {
    menuList,
    industryList,
    labelList,
    getMenu,
    getIndustry,
    getSubMenuList,
    isShop,
    isDang,
    isEquip,
    isRecruit,
    isShopOrDang,
    dictPublishTypeList,
    leafMenuList,
    conditionIndustryList,
    conditionMenuList,
    getPostAuditKey,
    getServiceAuditKey
}
